package com.sinry.common.core.config;

import com.sinry.common.core.interceptors.ResponseInterceptor;
import lombok.NonNull;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author linxinlei
 * @project sinry-cloud
 * @description web配置
 * @date 2022/5/22
 **/
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private ResponseInterceptor responseInterceptor;

    @Override
    public void addInterceptors(@NonNull InterceptorRegistry registry) {
        registry.addInterceptor(this.responseInterceptor).addPathPatterns("/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
